import React from 'react'
import ReactDOM from 'react-dom'
import 'antd/dist/antd.less'
import './assets/css/global.scss'
import reportWebVitals from './reportWebVitals'
import Routes from './router'
import store, { persistor } from './store'
import { PersistGate } from 'redux-persist/integration/react'
import { Provider } from 'react-redux'
// ConfigProvider 为组件提供统一的全局化配置，使用 React 的 context 特性，只需在应用外围包裹一次即可全局生效。
import { ConfigProvider } from 'antd'
// 由于 antd 组件的默认文案是英文，所以需要修改为中文
import zhCN from 'antd/lib/locale/zh_CN'
import moment from 'moment'
import 'moment/locale/zh-cn'

moment.locale('zh-cn')
ReactDOM.render(
  <Provider store={store}>
    <PersistGate loading={null} persistor={persistor}>
      <ConfigProvider locale={zhCN}>
        <Routes />
      </ConfigProvider>
    </PersistGate>
  </Provider>,
  document.getElementById('carefree-admin-root'),
)

// If you want to start measuring performance in your app, pass a function
// to log results (for example: reportWebVitals(console.log))
// or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
reportWebVitals()
